


<!doctype html>
<html lang="zh" class="no-js">
  <head>
    
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1">
      
      
      
      <link rel="shortcut icon" href="../../images/logo.ico">
      <meta name="generator" content="mkdocs-1.1.2, mkdocs-material-5.5.3">
    
    
      
        <title>analyse 模块 - spipy 使用教程</title>
      
    
    
      <link rel="stylesheet" href="../../assets/stylesheets/main.947af8d5.min.css">
      
        <link rel="stylesheet" href="../../assets/stylesheets/palette.7f672a1f.min.css">
      
      
        
        
        <meta name="theme-color" content="#009688">
      
    
    
    
      
        <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7C&display=fallback">
        <style>body,input{font-family:"Roboto",-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"",SFMono-Regular,Consolas,Menlo,monospace}</style>
      
    
    
    
    
      
    
    
  </head>
  
  
    
    
    
    <body dir="ltr" data-md-color-scheme="" data-md-color-primary="teal" data-md-color-accent="teal">
  
    
    <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
    <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
    <label class="md-overlay" for="__drawer"></label>
    <div data-md-component="skip">
      
        
        <a href="#analyseq" class="md-skip">
          跳转至
        </a>
      
    </div>
    <div data-md-component="announce">
      
    </div>
    
      <header class="md-header" data-md-component="header">
  <nav class="md-header-nav md-grid" aria-label="Header">
    <a href="../.." title="spipy 使用教程" class="md-header-nav__button md-logo" aria-label="spipy 使用教程">
      
  <img src="../../images/logo.png" alt="logo">

    </a>
    <label class="md-header-nav__button md-icon" for="__drawer">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
    </label>
    <div class="md-header-nav__title" data-md-component="header-title">
      
        <div class="md-header-nav__ellipsis">
          <span class="md-header-nav__topic md-ellipsis">
            spipy 使用教程
          </span>
          <span class="md-header-nav__topic md-ellipsis">
            
              analyse 模块
            
          </span>
        </div>
      
    </div>
    
      <label class="md-header-nav__button md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
      </label>
      
<div class="md-search" data-md-component="search" role="dialog">
  <label class="md-search__overlay" for="__search"></label>
  <div class="md-search__inner" role="search">
    <form class="md-search__form" name="search">
      <input type="text" class="md-search__input" name="query" aria-label="搜索" placeholder="搜索" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active">
      <label class="md-search__icon md-icon" for="__search">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
      </label>
      <button type="reset" class="md-search__icon md-icon" aria-label="Clear" data-md-component="search-reset" tabindex="-1">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
      </button>
    </form>
    <div class="md-search__output">
      <div class="md-search__scrollwrap" data-md-scrollfix>
        <div class="md-search-result" data-md-component="search-result">
          <div class="md-search-result__meta">
            Initializing search
          </div>
          <ol class="md-search-result__list"></ol>
        </div>
      </div>
    </div>
  </div>
</div>
    
    
  </nav>
</header>
    
    <div class="md-container" data-md-component="container">
      
        
      
      
        
      
      <main class="md-main" data-md-component="main">
        <div class="md-main__inner md-grid">
          
            
              <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
  <label class="md-nav__title" for="__drawer">
    <a href="../.." title="spipy 使用教程" class="md-nav__button md-logo" aria-label="spipy 使用教程">
      
  <img src="../../images/logo.png" alt="logo">

    </a>
    spipy 使用教程
  </label>
  
  <ul class="md-nav__list" data-md-scrollfix>
    
      
      
      


  <li class="md-nav__item">
    <a href="../.." title="简介" class="md-nav__link">
      简介
    </a>
  </li>

    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2">
    
    <label class="md-nav__link" for="nav-2">
      快速上手
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="快速上手" data-md-level="1">
      <label class="md-nav__title" for="nav-2">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        快速上手
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../../Getting-Started/installation/" title="安装" class="md-nav__link">
      安装
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../Getting-Started/framework/" title="模块架构" class="md-nav__link">
      模块架构
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../Getting-Started/best-practice/" title="使用例子" class="md-nav__link">
      使用例子
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
    
    <label class="md-nav__link" for="nav-3">
      命令行工具
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="命令行工具" data-md-level="1">
      <label class="md-nav__title" for="nav-3">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        命令行工具
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../../Scripts/Introduction/" title="简介" class="md-nav__link">
      简介
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../Scripts/Integrated-UI/" title="集成可视化工具" class="md-nav__link">
      集成可视化工具
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
      
      
      

  


  <li class="md-nav__item md-nav__item--active md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4" checked>
    
    <label class="md-nav__link" for="nav-4">
      API文档
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="API文档" data-md-level="1">
      <label class="md-nav__title" for="nav-4">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        API文档
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          

  


  <li class="md-nav__item md-nav__item--active">
    
    <input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
    
    
      <label class="md-nav__link md-nav__link--active" for="__toc">
        analyse模块
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 9h14V7H3v2m0 4h14v-2H3v2m0 4h14v-2H3v2m16 0h2v-2h-2v2m0-10v2h2V7h-2m0 6h2v-2h-2v2z"/></svg>
        </span>
      </label>
    
    <a href="./" title="analyse模块" class="md-nav__link md-nav__link--active">
      analyse模块
    </a>
    
      
<nav class="md-nav md-nav--secondary" aria-label="目录">
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
      </span>
      目录
    </label>
    <ul class="md-nav__list" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#analyseq" class="md-nav__link">
    analyse.q
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analysesaxs" class="md-nav__link">
    analyse.saxs
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analyseorientation" class="md-nav__link">
    analyse.orientation
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analysecriterion" class="md-nav__link">
    analyse.criterion
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analyserotate" class="md-nav__link">
    analyse.rotate
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analysesh_expan" class="md-nav__link">
    analyse.SH_expan
  </a>
  
</li>
      
    </ul>
  
</nav>
    
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../image/" title="image模块" class="md-nav__link">
      image模块
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../merge/" title="merge模块" class="md-nav__link">
      merge模块
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../phase/" title="phase模块" class="md-nav__link">
      phase模块
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../simulate/" title="simulate模块" class="md-nav__link">
      simulate模块
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
      
      
      


  <li class="md-nav__item md-nav__item--nested">
    
      <input class="md-nav__toggle md-toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
    
    <label class="md-nav__link" for="nav-5">
      图形界面
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.59 16.58L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.42z"/></svg>
      </span>
    </label>
    <nav class="md-nav" aria-label="图形界面" data-md-level="1">
      <label class="md-nav__title" for="nav-5">
        <span class="md-nav__icon md-icon">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
        </span>
        图形界面
      </label>
      <ul class="md-nav__list" data-md-scrollfix>
        
        
          
          
          


  <li class="md-nav__item">
    <a href="../../Graphics-UI/installation/" title="安装" class="md-nav__link">
      安装
    </a>
  </li>

        
          
          
          


  <li class="md-nav__item">
    <a href="../../Graphics-UI/preview/" title="预览" class="md-nav__link">
      预览
    </a>
  </li>

        
      </ul>
    </nav>
  </li>

    
  </ul>
</nav>
                  </div>
                </div>
              </div>
            
            
              <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
                <div class="md-sidebar__scrollwrap">
                  <div class="md-sidebar__inner">
                    
<nav class="md-nav md-nav--secondary" aria-label="目录">
  
  
  
    <label class="md-nav__title" for="__toc">
      <span class="md-nav__icon md-icon">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
      </span>
      目录
    </label>
    <ul class="md-nav__list" data-md-scrollfix>
      
        <li class="md-nav__item">
  <a href="#analyseq" class="md-nav__link">
    analyse.q
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analysesaxs" class="md-nav__link">
    analyse.saxs
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analyseorientation" class="md-nav__link">
    analyse.orientation
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analysecriterion" class="md-nav__link">
    analyse.criterion
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analyserotate" class="md-nav__link">
    analyse.rotate
  </a>
  
</li>
      
        <li class="md-nav__item">
  <a href="#analysesh_expan" class="md-nav__link">
    analyse.SH_expan
  </a>
  
</li>
      
    </ul>
  
</nav>
                  </div>
                </div>
              </div>
            
          
          <div class="md-content">
            <article class="md-content__inner md-typeset">
              
                
                
                  
                
                
                  <h1>analyse模块</h1>
                
                <h3 id="analyseq">analyse.q</h3>
<ul>
<li>
<p><strong>cal_q</strong> (detd, lamda, det_r, pixsize)</p>
<ul>
<li><code>detd</code> : distance between detector and sample, unit=mm</li>
<li><code>lamda</code> : wave length, unit=Angstrom</li>
<li><code>det_r</code> : the highest resolution (radius on detector) that you want to calculate to, unit=pixel</li>
<li><code>pixsize</code> : physical length of a detector pixel, unit=mm</li>
</ul>
<p>[<strong>return</strong>] reciprocal q array, shape=(det_r,), unit=nm<sup>-1</sup></p>
</li>
<li>
<p><strong>cal_q_pat</strong> (detd, lamda, pixsize, det_size, center=None)</p>
<ul>
<li><code>detd</code> : distance between detector and sample, unit=mm</li>
<li><code>lamda</code> : wave length, unit=Angstrom</li>
<li><code>pixsize</code> : physical length of a detector pixel, unit=mm</li>
<li><code>det_size</code> : detector size in pixels, (size_x, size_y)</li>
<li><code>denter</code> : center of pattern, (Cx, Cy)</li>
</ul>
<p>[<strong>return</strong>] reciprocal q array of a pattern, shape=(Nq,), unit=nm<sup>-1</sup></p>
</li>
<li>
<p><strong>cal_r</strong> (qlist, detd, lamda, pixsize)</p>
<ul>
<li><code>qlist</code> : numpy array, shape=(Nq,), unit=nm<sup>-1</sup></li>
<li><code>detd</code> : distance between detector and sample, unit=mm</li>
<li><code>lamda</code> : wave length, unit=Angstrom</li>
<li><code>pixsize</code> : physical length of a detector pixel, unit=mm</li>
</ul>
<p>[<strong>return</strong>] inverse calculation of cal_q, return r, shape=qlist.shape</p>
</li>
<li>
<p><strong>oversamp_rate</strong> (sample_size, detd, lamda, pixsize)</p>
<ul>
<li><code>sample_size</code> : diameter of your experiment sample, unit=nm</li>
<li><code>detd</code> : distance between detector and sample, unit=mm</li>
<li><code>lamda</code> : wave length, unit=Angstrom</li>
<li><code>pixsize</code> : physical length of a detector pixel, unit=mm</li>
</ul>
<p>[<strong>return</strong>] oversampling rate, float</p>
</li>
<li>
<p><strong>ewald_mapping</strong> (detd, lamda, pixsize, det_size, center=None)</p>
<ul>
<li><code>detd</code> : distance between detector and sample, unit=mm</li>
<li><code>lamda</code> : wave length, unit=Angstrom</li>
<li><code>pixsize</code> : physical length of a detector pixel, unit=mm</li>
<li><code>det_size</code> : detector size in pixels, (size_x, size_y)</li>
<li><code>center</code> : center of pattern, (Cx, Cy), default=None</li>
</ul>
<p>[<strong>return</strong>] map detector pixels into 3D k-space, return (q_coor, qmax, qmin, q_len). "<em>q_coor</em>" is 3D coordinates in k-space, shape=(3,size_x,size_y); "<em>qmax</em>" is the maximum q value of detector; "<em>qmin</em>" is the minimum q value of detector; "<em>q_len</em>" is the side length of k space matrix in pixel.</p>
</li>
</ul>
<hr />
<h3 id="analysesaxs">analyse.saxs</h3>
<ul>
<li>
<p><strong>friedel_search</strong> (pattern, estimated_center, mask=None, small_r=None, large_r=None)</p>
<ul>
<li><code>pattern</code> : input pattern, numpy array, shape=(Nx,Ny)</li>
<li><code>estimated_center</code> : estimated center of the pattern, (Cx, Cy), near to real center</li>
<li><code>mask</code> : 0/1 two-value numpy array, shape=(Nx,Ny), 1 means masked pixel. Nan/Inf/negtive pixels should be maksed</li>
<li><code>small_r</code> : int, radius of search area for center allocation candidates, in pixel</li>
<li><code>large_r</code> : int, radius of area for sampling friedel twin points, in pixel</li>
</ul>
<p>[<strong>return</strong>] central point (q=0) of the pattern, (Cx, Cy), the precision is 1 pixel</p>
</li>
<li>
<p><strong>center_refine</strong> (pattern, center, mask=None, sampling=300, roir=20)</p>
<ul>
<li><code>pattern</code> : input pattern, numpy array, shape=(Nx,Ny)</li>
<li><code>center</code> : center from friedel_search, [Cx,Cy]</li>
<li><code>mask</code> : 0/1 two-value numpy array, shape=(Nx,Ny), 1 means masked pixel. Nan/Inf/negtive pixels should be maksed</li>
<li><code>sampling</code> : Number of sampled pixels for refinement</li>
<li><code>roir</code> : Radius of a circle area for pixel sampling, in pixel</li>
</ul>
<p>[<strong>return</strong>] refined central point (q=0) of the pattern, (Cx, Cy)</p>
</li>
<li>
<p><strong>inten_profile_vaccurate</strong> (dataset, mask, *exp_param)</p>
<ul>
<li><code>dataset</code> : numpy array, shape=(Nd,Nx,Ny)</li>
<li><code>mask</code> : 0/1 two-value numpy array, shape=(Nx,Ny), 1 means masked pixel</li>
<li><code>*exp_param</code> : detd (mm) , lamda (A), det_r (pixel), pixsize (mm)</li>
</ul>
<p>[<strong>return</strong>] calculate averaged intensity radial profile of diffraction dataset, return numpy array, shape=(Nq,2), first column is q value, second column is radial intensities</p>
</li>
<li>
<p><strong>inten_profile_vfast</strong> (dataset, mask, *exp_param)</p>
<ul>
<li>same with 'inten_profile_vaccurate'</li>
</ul>
<p>[<strong>return</strong>] same with 'inten_profile_vaccurate', but assumed all patterns in the dataset have same center point</p>
</li>
<li>
<p><strong>cal_saxs</strong> (data)</p>
<ul>
<li><code>data</code> : patterns, numpy array, shape=(Nd,Nx,Ny)</li>
</ul>
<p>[<strong>return</strong>] averaged pattern of diffraction dataset, shape=(Nx,Ny)</p>
</li>
<li>
<p><strong>centering</strong> (pat, estimated_center, mask=None, small_r=None, large_r=None)</p>
<ul>
<li><code>pat</code> : input pattern, numpy array, shape=(Nx,Ny)</li>
<li><code>mask</code> : 0/1 two-value numpy array, shape=(Nx,Ny), 1 means masked pixel</li>
<li><code>small_r</code> : int, radius of search area for center allocation candidates, in pixel</li>
<li><code>large_r</code> : int, radius of area for sampling friedel twin points, in pixel</li>
</ul>
<p>[<strong>return</strong>] shift the q=0 point to geometric center and output new pattern (Note that the new pattern may be smaller than original one), return (newpat, newmask). "newpat" and "newmask" are both numpy array, shape=(Nx',Ny')</p>
</li>
<li>
<p><strong>particle_size</strong> (saxs, estimated_center, exparam=None, high_filter_cut=0.3, power=0.7, mask=None)</p>
<ul>
<li><code>saxs</code> : saxs pattern, numpy array, shape=(Nx,Ny)</li>
<li><code>estimated_center</code> : estimated center of saxs pattern, (Cx, Cy), error within 20 pixels</li>
<li><code>exparam</code> : experimetnal parameters, str, "detector-sample distance(mm),lambda(A),pixel length(mm)". For example, "578,7.9,0.3"</li>
<li><code>high_filter_cut</code> : float between (0,1), which determine the FWHM of high pass filter, larger value means smaller filter width</li>
<li><code>power</code> : float between (0,1), a power conducted on pattern to enhance the contribution of high q values</li>
<li><code>mask</code> : 0/1 two-value numpy array, shape=(Nx,Ny), 1 means masked pixel</li>
</ul>
<p>[<strong>return</strong>] estimate particel size, return (particle_size, auto_correlation_radial_profile). "particle_size" is the estimated particle diameter in nm; "auto_correlation_radial_profile" is a numpy array with shape=(Nd,2), the 1st column is particle diameter in nm (if exparam is given) and 2nd colum is the auto-correlation value. The locations of peaks in auto_correlation_radial_profile give most trustable values of possible particle sizes</p>
</li>
<li>
<p><strong>particle_size_sp</strong> (dataset, exparam, fitarea, badsearchr, method, mask=None, center=None, verbose=True)</p>
<ul>
<li><code>dataset</code> : a set of patterns, numpy array, shape=(Nd,Nx,Ny)</li>
<li><code>exparam</code> : experimental parameters, a list [detector-distance(mm), lambda(A), pixel-length(mm)]</li>
<li><code>fitarea</code> : a list [nr, nR], define an ring area (ROI) to do the fitting</li>
<li><code>badsearchr</code> : int, if there are more than 10 peaks (within fit area) in the radial profile whose radii&lt;=badsearchr , the pattern will be dropped, unit=pixel</li>
<li><code>method</code> : fitting method, str, chosen from 'q0' (use the first Iq minimum position to estimate diameter) or 'lsq' (fit theoretical Iq curve to given patterns to estimate diameter)</li>
<li><code>mask</code> : 0/1 two-value numpy array, shape=(Nx,Ny), 1 means masked pixel</li>
<li><code>center</code> : center location of diffraction patterns, (Cx,Cy)</li>
<li><code>verbose</code> : bool, whether to display progress bar</li>
</ul>
<p>[<strong>return</strong>] fit the diameters of spherical-like samples using Iq curve of their diffraction patterns, return diameters in nm, shape=(Nd,)</p>
</li>
</ul>
<hr />
<h3 id="analyseorientation">analyse.orientation</h3>
<ul>
<li>
<p><strong>Sphere_randp</strong> (algo, radius, num)</p>
<ul>
<li><code>algo</code> : algorithm, string, "random" or "uniform-1" (standard Fibonacci spherical mapping) or "uniform-2" (modified Fibonacci spherical mapping)</li>
<li><code>radius</code> : radius of the sphere, unit=pixels</li>
<li><code>num</code> : number of points you want to generate</li>
</ul>
<p>[<strong>return</strong>] random/uniform distributed points on a pherical surface, return (xyz, azi). "xyz" is Euclid coordinates of points, numpy array, shape=(Np,3); "azi" is azimuth coordinates, numpy array, shape=(Np,2)</p>
</li>
<li>
<p><strong>proc_Hammer</strong> (qlist, data)</p>
<ul>
<li><code>qlist</code> : quaternion list, numpy.array( [ w[..], qx[..], qy[..], qz[..] ] ); or xyz coordinates, numpy.array( [ x[..], y[..], z[..] ] ). That is, shape=(Nq, 4) or (Nq,3)</li>
<li><code>data</code> : the corresponding value for every quaternion (orientation), this function do not care what the values in data really mean. shape=(Nq,1)</li>
</ul>
<p>[<strong>return</strong>] transfer quaternions to Aitoff-Hammer projection coordinates, return (logi_lati, x_y). "logi_lati" is numpy.array([ logitute[..], latitute[..], value[..] ]), shape=(Nq,3); "x_y" is numpy.array([ x[..], y[..], value[..] ]), shape=(Nq,3)</p>
</li>
<li>
<p><strong>draw_hammer</strong> (logi_lati, save_dir=None)</p>
<ul>
<li><code>logi_lati</code> : Logitute, latitute and value, shape=(Nq,3) ( The first output of proc_Hammer )</li>
<li><code>save_dir</code> : string, the path if you want to save figure</li>
</ul>
<p>[<strong>return</strong>] None</p>
</li>
<li>
<p><strong>draw_ori_Df</strong> (ori_bin, q_level)</p>
<ul>
<li><code>ori_bin</code> : string, path of 'orientation_xxx.bin' file from spipy.merge.emc output</li>
<li><code>q_level</code> : the 'num_div' parameter used in spipy.merge.emc, int</li>
</ul>
<p>[<strong>return</strong>] None</p>
</li>
</ul>
<hr />
<h3 id="analysecriterion">analyse.criterion</h3>
<ul>
<li>
<p><strong>r_factor</strong> (F_cal, F_obs)</p>
<ul>
<li><code>F_cal</code> : voxel models from calculation, numpy array</li>
<li><code>F_obs</code> : voxel models from observation, numpy array</li>
</ul>
<p>[<strong>return</strong>] overall r-factor of two models, a float between [0,1]</p>
</li>
<li>
<p><strong>r_factor_shell</strong> (F_cal, F_obs, rlist)</p>
<ul>
<li><code>F_cal</code> : voxel models from calculation, numpy array</li>
<li><code>F_obs</code> : voxel models from observation, numpy array</li>
<li><code>rlist</code> : radii list of shells, list/array, length=Nr</li>
</ul>
<p>[<strong>return</strong>] r-factor of shells with different radius between two models, return a numpy array, shape=(Nr,)</p>
</li>
<li>
<p><strong>fsc</strong> (F1, F2, rlist)</p>
<ul>
<li><code>F1</code> : the first voxel model, numpy array</li>
<li><code>F2</code> : the second voxel model, numpy array</li>
<li><code>rlist</code> : radii list of shells, list/array, length=Nr</li>
</ul>
<p>[<strong>return</strong>] Fourier Shell Correlation between two models (in reciprocal space), numpy array, shape=(Nr,)</p>
</li>
<li>
<p><strong>r_split</strong> (F1, F2, rlist)</p>
<ul>
<li><code>F1</code> : the first voxel model, numpy array</li>
<li><code>F2</code> : the second voxel model, numpy array</li>
<li><code>rlist</code> : radii list of shells, list/array, length=Nr</li>
</ul>
<p>[<strong>return</strong>]  R-split factors between two models (in reciprocal space), numpy array, shape=(Nr,)</p>
</li>
<li>
<p><strong>Pearson_cc</strong> (exp_d, ref_d, axis=-1)</p>
<ul>
<li><code>exp_d</code> : the first (numpy) array, support any dimensional array</li>
<li><code>ref_d</code> : the second (numpy) array, same shape with exp_d</li>
<li><code>axis</code> : use which axis to calculate cc, default is -1 (the last dimension), if axis!=-1 then use all dimensions</li>
</ul>
<p>[<strong>return</strong>] Pearson correlation coefficient between two arrays, numpy array, dimension is N-1 for axis=-1 (N is the dimension of input array), return a float if axis!=-1</p>
</li>
<li>
<p><strong>PRTF</strong> (phased_reciprocal, center, mask=None)</p>
<ul>
<li><code>phased_reciprocal</code> : the reciprocal dataset after N times' independent phasing, dtype=numpy.complex128, shape=(N,Npx,Npy) (2d data) or shape=(N,Npx,Npy,Npz) (3d data)</li>
<li><code>center</code> : the coordinates of zero frequency, (Cx,Cy)</li>
<li><code>mask</code> : 0/1 two-value numpy array, shape=(Npx,Npy) or (Npx,Npy,Npz), 1 means masked pixel</li>
</ul>
<p>[<strong>return</strong>] Phase Retrieval Transfer Function of phased dataset (2D/3D), return radial profile of PRTF matrix, shape=(Np,3), three columns are (r, prtf, std-err)</p>
</li>
</ul>
<hr />
<h3 id="analyserotate">analyse.rotate</h3>
<ul>
<li>
<p><strong>eul2rotm</strong> (ea, order)</p>
<ul>
<li><code>ea</code> : euler angles, intrinsic rotation, [alpha,beta,gamma], unit=rad</li>
<li><code>order</code> : rotation order, such as 'zxz', 'zyz' or 'xyz'</li>
</ul>
<p>[<strong>return</strong>] transfer euler angles to rotation matrix in intrinsic order, return rotation matrix, numpy array, shape=(3,3)</p>
</li>
<li>
<p><strong>rot_ext</strong> (ea, order, vol, ref=None)</p>
<ul>
<li><code>ea</code> : euler angles, intrinsic rotation, [alpha,beta,gamma], unit=rad</li>
<li><code>order</code> : rotation order, such as 'zxz', 'zyz', 'xyz'</li>
<li><code>matrix</code> : 3d voxel model to be rotated, numpy array, shape=(Nx,Ny,Nz)</li>
<li><code>ref</code> : reference 3d model, if given, program will compare rotated model with reference model by ploting their x/y/z slices</li>
</ul>
<p>[<strong>return</strong>] extrinsic rotation to a 3D voxel model, return rotated model, numpy array, shape=(Nx,Ny,Nz)</p>
</li>
<li>
<p><strong>align</strong> (fix, mov, grid_unit=[0.3, 0.1], nproc=2, resize=40, order='zxz')</p>
<ul>
<li><code>fix</code> : fixed model, numpy array, shape=(Nx,Ny,Nz)</li>
<li><code>mov</code> : rotated model while aligning, numpy array, shape=(Nx,Ny,Nz)</li>
<li><code>grid_unit</code> : grid size (in rad) of alpha,beta,gamma euler angles. This is a list, default=[0.3, 0.1], which means the program will firstly search with grid_size = 0.3 rad, then refine the euler angles with smaller grid_size (= 0.1 rad) from what it just gets that best align two models. Of course you can use more loops such as [0.3, 0.1, 0.02, ...]</li>
<li><code>nproc</code> : number of processes to run in parallel, NOTE that the program parallels in alpha angles</li>
<li><code>resize</code> : resize your input models to a smaller size to accelerate</li>
<li><code>order</code> : rotation order while aligning</li>
</ul>
<p>[<strong>return</strong>] align two models by euler angle grid search, return (r_factor, ea, new_mov). "r_factor" is overall r-factor between fixed and best aligned mov model, float; "ea" is best aligned euler angle, [al,be,ga]; "new_mov" is mov model after aligned, numpy array, shape=(Nx,Ny,Nz)</p>
</li>
</ul>
<hr />
<h3 id="analysesh_expan">analyse.SH_expan</h3>
<ul>
<li>
<p><strong>sp_hamonics</strong> (data, r, L=10)</p>
<ul>
<li><code>data</code> : {'volume':voxel data intensity, 'mask':voxel data mask}, if no mask please set 'mask' : None; shape=(Nx,Ny,Nz)</li>
<li><code>r</code> : radius of the shell you want to expand, unit=pixel</li>
<li><code>L</code> : level of hamonics, recommended &gt;=10</li>
</ul>
<p>[<strong>return</strong>] spherical harmonics expansion 'C(l,m)' of a 3D model, return C(l), shape=(L,)</p>
</li>
</ul>
                
                  
                
              
              
                


              
            </article>
          </div>
        </div>
      </main>
      
        
<footer class="md-footer">
  
    <div class="md-footer-nav">
      <nav class="md-footer-nav__inner md-grid" aria-label="Footer">
        
          <a href="../../Scripts/Integrated-UI/" title="集成可视化工具" class="md-footer-nav__link md-footer-nav__link--prev" rel="prev">
            <div class="md-footer-nav__button md-icon">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
            </div>
            <div class="md-footer-nav__title">
              <div class="md-ellipsis">
                <span class="md-footer-nav__direction">
                  上一页
                </span>
                集成可视化工具
              </div>
            </div>
          </a>
        
        
          <a href="../image/" title="image模块" class="md-footer-nav__link md-footer-nav__link--next" rel="next">
            <div class="md-footer-nav__title">
              <div class="md-ellipsis">
                <span class="md-footer-nav__direction">
                  下一页
                </span>
                image模块
              </div>
            </div>
            <div class="md-footer-nav__button md-icon">
              <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
            </div>
          </a>
        
      </nav>
    </div>
  
  <div class="md-footer-meta md-typeset">
    <div class="md-footer-meta__inner md-grid">
      <div class="md-footer-copyright">
        
        Made with
        <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
          Material for MkDocs
        </a>
      </div>
      
    </div>
  </div>
</footer>
      
    </div>
    
      <script src="../../assets/javascripts/vendor.c3dc8c49.min.js"></script>
      <script src="../../assets/javascripts/bundle.f9edbbd5.min.js"></script><script id="__lang" type="application/json">{"clipboard.copy": "\u590d\u5236", "clipboard.copied": "\u5df2\u590d\u5236", "search.config.lang": "ja", "search.config.pipeline": "trimmer, stemmer", "search.config.separator": "[\\uff0c\\u3002]+", "search.result.placeholder": "\u952e\u5165\u4ee5\u5f00\u59cb\u641c\u7d22", "search.result.none": "\u6ca1\u6709\u627e\u5230\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.one": "\u627e\u5230 1 \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c", "search.result.other": "# \u4e2a\u7b26\u5408\u6761\u4ef6\u7684\u7ed3\u679c"}</script>
      
      <script>
        app = initialize({
          base: "../..",
          features: [],
          search: Object.assign({
            worker: "../../assets/javascripts/worker/search.8e2cddea.min.js"
          }, typeof search !== "undefined" && search)
        })
      </script>
      
    
  </body>
</html>